from gui import gui

class application_window_fake :
    def __init__ ( self ) :
        self . _font = None
        self . _cget = { }
    def configure ( self , _fake_arg = None , font = None ) :
        self . _font = font
    def cget ( self , option ) :
        return self . _cget [ option ]

class font_fake :
    def __init__ ( self , font , font_name ) :
        self . _font = font
        self . _font_name = font_name
        self . name = None
    def configure ( self , _fake_arg = None , weight = None ) :
        self . name = self . _font_name + str ( weight )

class tkinter_fake :
    def __init__ ( self ) :
        self . _application_windows = [ ]
    def Tk ( self ) :
        window = application_window_fake ( )
        self . _application_windows += [ window ]
        return window
        
class tkfont_fake :
    def __init__ ( self ) :
        self . _fonts = [ ]
        self . _font_name = None
    def Font ( self , _fake_arg = None , font = None ) :
        new_font = font_fake ( font = font , font_name = self . _font_name )
        self . _fonts += [ new_font ]
        return new_font

class mediator_fake :
    def __init__ ( self ) :
        self . _gui_create_application_window_reply = None
    def gui_create_application_window_reply ( self , window ) :
        self . _gui_create_application_window_reply = window 

class gui_font_weight_tests :
    'gui_font_weight'
    def __init__ ( self , test ) :
        self . _test = test
        self . _tkinter = tkinter_fake ( )
        self . _tkfont = tkfont_fake ( )
        self . _mediator = mediator_fake ( )
        self . _gui = gui ( mediator = self . _mediator , tkinter = self . _tkinter , tkfont = self . _tkfont , scheduler = None )
    def test_gui_set_widget_font_weight_to_bold ( self ) :
        self . _gui . gui_create_application_window_request ( )
        window = self . _mediator . _gui_create_application_window_reply
        tk_window = self . _tkinter . _application_windows [ 0 ]
        tk_window . _cget [ 'font' ] = 'my widget font'
        self . _tkfont . _font_name = 'my font name'
        self . _gui . gui_set_widget_font_weight_to_bold ( window )
        self . _test . assume_equal ( tk_window . _font , 'my font name' + 'bold' )
        self . _test . assume_equal ( self . _tkfont . _fonts [ 0 ] . _font , 'my widget font' )
    def test_gui_push_widget_font ( self ) :
        self . _gui . gui_create_application_window_request ( )
        window = self . _mediator . _gui_create_application_window_reply
        tk_window = self . _tkinter . _application_windows [ 0 ]
        tk_window . _cget [ 'font' ] = 'my pushed font'
        tk_window . _font = 'my font'
        self . _gui . gui_push_widget_font ( window )
        self . _test . assume_equal ( tk_window . _font , 'my font' )
    def test_gui_pop_widget_font ( self ) :
        self . _gui . gui_create_application_window_request ( )
        window = self . _mediator . _gui_create_application_window_reply
        tk_window = self . _tkinter . _application_windows [ 0 ]
        tk_window . _cget [ 'font' ] = 'my pushed font'
        tk_window . _font = 'my font'
        self . _gui . gui_push_widget_font ( window )
        tk_window . _cget [ 'font' ] = 'my modified font'
        self . _gui . gui_pop_widget_font ( window )
        self . _test . assume_equal ( tk_window . _font , 'my pushed font' )
